package org.mspring.mlog.dao.impl;

import org.mspring.mlog.dao.RoleEntityDao;
import org.mspring.mlog.entity.RoleEntity;
import org.mspring.nbee.db.dao.impl.BaseDao;
import org.mspring.nbee.db.dao.sql.Sql;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Gao Youbo
 * @since 2014-09-10 11:51:15
 */
@Repository
public class RoleEntityDaoImpl extends BaseDao<RoleEntity> implements RoleEntityDao {

    @Override
    public List<RoleEntity> listByUser(long userId) {
        Sql sql = new Sql("select role.* from t_role role left join t_user_role user_role on role.id = user_role.role_id where user_role.user_id = ?", userId);
        return super.listBySql(sql);
    }

}
